function add(num1, num2, num3) {
  return num1 + num2 + num3;
}
//柯里化函数的实现
function zhCurrying(fn) {
  function curried(...args) {
    if (args.length >= fn.length) {
      return fn.apply(this, args);
    } else {
      function curried2(...args2) {
        return curried.apply(this, [...args, ...args2]);
      }
      return curried2;
    }
  }
  return curried;
}

var curryAdd = zhCurrying(add);
console.log(`curryAdd(1)(2)(3)`, curryAdd(1)(2)(3));
